home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-07-11 | 2.2 KB | 74 lines | [TEXT/MMCC] |
- // LifeModules.h
- // Interface to routines to handle the Life Implementation Modules for Mike's Life.
- // Copyright ©1995 Michael D. Crawford. All Rights Reserved.
- // 23 Jun 95 Mike Crawford crawford@scruznet.com
- //
- // Revision History:
- // 23 Jun 95 MDC New today
-
- typedef struct{
- long top;
- long left;
- long right;
- long bottom;
- }tLongRect;
-
- enum{
- kBuiltIn,
- k68kCodeResource,
- kPPCCodeFrag
- };
-
- // Allocate the memory for a life world
- typedef OSErr (*tLifeAllocProc)( tLifeWorldPtr worldPtr, long height, long width );
-
- // Clear a rectangle of cells
- typedef OSErr (*tClearRectProc)( tLifeWorldPtr worldPtr, tLongRect *theRectPtr );
-
- // Free a life world when one is through with it.
- typedef OSErr (*tFreeProc)( tLifeWorldPtr worldPtr );
-
- // Draw a single cell; used while interactively sketching
- typedef OSErr (*tDrawCellProc)( tLifeWorldPtr worldPtr, long h, long v );
-
- // Switch the state of a cell
- typedef OSErr (*tToggleCellProc)( tLifeWorldPtr worldPtr, long h, long v );
-
- // Step a single generation. This might include a blit to the screen
- typedef OSErr (*tStepProc)( tLifeWorldPtr );
-
- // Draw to the window in a normal, QuickDraw way, as for handling an update
- typedef OSErr (*tDrawWinProc)( tLifeWorldPtr worldPtr );
-
- typedef struct {
- tStepProc stepProc;
- tLifeAllocProc allocProc;
- tClearRectProc clearPixProc;
- tFreeProc freeProc;
- tToggleCellProc toggleProc;
- tDrawCellProc drawCellProc;
- tDrawWinProc drawProc;
- FSSpec fileSpec; // vRef is 0 for built-ins
- short procType;
- }tLifeProcRecord, *tLifeProcsPtr;
-
- OSErr InitModules( void );
-
- OSErr AddLifeProcs( tLifeProcsPtr lifeProcPtr,
- short procType,
- StringPtr menuStr,
- tStepProc stepProc,
- tLifeAllocProc allocProc,
- tClearRectProc clearPixProc,
- tFreeProc freeProc,
- tToggleCellProc toggleProc,
- tDrawCellProc drawCellProc,
- tDrawWinProc drawProc,
- FSSpecPtr specPtr );
-
- void *GetModuleProcs( short moduleNumber ); // Returns pointer to life procs rec
-
- OSErr AllocLifeWorld( tLifeWorldPtr worldPtr, long height, long width );
- OSErr LifeStep( tLifeWorldPtr worldPtr );
- OSErr ClearCells( tLifeWorldPtr worldPtr, tLongRect *rPtr );
- OSErr DrawLifeWorld( tLifeWorldPtr worldPtr );